addAttributes (
attrFile,
models=None,
log=False,
raiseAttrDialog=True,
)
add/set attributes from a file
attrFile indicates a file path or an opened file object. The
file contains control lines and data lines. Control and data lines
may be freely interspersed. The data lines are of the form: selectorattribute value
The selector is an atom specification (as per the Atom Specification
section of the User's Guide). The attribute value is a boolean,
integer, float, or string. If it is necessary to specify a string
attribute that could be interpreted as one of the other types,
embed the value in double quotes (it will then be evaluated as a
Python string, including backslash interpretation).
The control lines are of the form:
name: value
The possible name/value pairs are:
Name Value
---- -----
attribute name of the attribute to assign to
match mode expected matches per selector:
"1 to 1": exactly one match per selector
"non-zero": at least one match per selector
"any": no constraint
selectors not conforming to the match mode will
generate an error
recipient where to put attribute (atoms/residues/molecules)
The only mandatory control line is attribute , which must precede
any data lines. The default match mode is 1 to 1, and the default
recipient is atoms.
Empty lines are ignored and lines beginning with the # character
are considered comments and ignored.
log controls whether information about what each selector matched
is sent to the reply log.
models restricts any selector matching to the given models. If
models is None, then no restriction occurs.
This function return a list of recipient/attribute tuples that
actually were set in at least one object. If an error occurred,
None is returned instead.
|